package com.yxy.mapper;

import com.github.pagehelper.Page;
import com.yxy.pojo.dto.TypeDTO;
import com.yxy.pojo.entity.WantOrSee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface WantOrSeeMapper {

    /**
     * 根据图书或影视的id和用户id查询用户对图书或电影的想看或看过的状态
     * @param typeDTO
     * @return
     */
    @Select("select * from want_or_see where type = #{type} and type_id = #{typeId} and user_id = #{userId}")
    WantOrSee select(TypeDTO typeDTO);

    /**
     * 根据用户id和图书id或影视id来进行分页查询
     *
     * @param wantOrSee
     * @return
     */
    Page<WantOrSee> selectList(WantOrSee wantOrSee);

    /**
     * 初始化用户对图书或电影的想看或看过的状态
     * @param wantOrSee
     */
    void initStatus(WantOrSee wantOrSee);

    /**
     * 更新用户对图书或电影的想看或看过的状态
     * @param wantOrSee
     * @return
     */
    void updateStatus(WantOrSee wantOrSee);

}
